import Vue from 'vue'
import VueRouter from 'vue-router'

// import Home from '../components/Home.vue'
// import Search from '../components/Search.vue'
import personage from '@/components/personage'
import writing from '@/components/writing'

// 懒加载 动态加载
const Home = () => import('../components/Home.vue')
const Search = () => import('../components/Search.vue')
import Vedio from "../components/common/card/Vedios";
import shou from "@/components/shou";
import spacehome from "@/components/personageSpace/spacehome";
import fansAttention  from "@/components/common/fans/fansAttention";
import othershome  from "@/components/common/othersspace/othershome";
import * as path from "path";

import DeliveringSuccessful from '../components/DeliveringSuccessful'
import DC from "../components/DC";
import A from "../components/A";
Vue.use(VueRouter)

// 路由操作 no-referrer 解决跨域问题
const routes = [
    {path: '/', redirect: '/home'},
    {
        path: '/home', component: Home, meta: {
            title: "ViliVili",
            name: "referrer",
            content: "no-referrer"
        }
    },
    {
        path: '/search', component: Search, meta: {
            title: "ViliVili",
            name: "referrer",
            content: "no-referrer"
        }
    },
    {
        path: '/A',
        name: 'A',
        component: A
    },
    {
        path: '/per',
        name: 'personage',
        component: personage,
        redirect: shou,
        children: [{
            //{ path: '/', redirect: '/home' },
            path: '/mes',
            name: 'Message',
            // redirect:'/'
            component: () => import("../components/Message")
        }, {
            path: '/passwd',
            name: 'password',
            component: () => import("../components/password")
        }, {
            path: '/shou',
            name: 'shou',
            component: shou
        }, {
            path: '/head',
            name: 'head',
            component: () => import("../components/head")
        }, {
            path: '/safe',
            name: 'safe',
            component: () => import("../components/safe")
        }
        ]
    }, {
        path: '/wr',
        name: 'writing',
        component: writing,
        children: [
            {
                path: '/con',
                name: 'con',
                component: () => import("../components/contribute")
            }, {
                path: '/mvideo',
                name: 'Mvideo',
                component: () => import("../components/Mvideo")
            }, {
                path: '/CommentAdmin',
                name: 'CommentAdmin',
                component: () => import("../components/CommentAdmin")
            }, {
                path: '/BulletAdmin',
                name: 'BulletAdmin',
                component: () => import("../components/BulletAdmin")
            },
            {
                path: '/DeliveringSuccessful',
                component: DeliveringSuccessful,
                name: 'DeliveringSuccessful'
            },
            {
                path: '/DC',
                component: DC,
                name: 'DC'
            }
        ]
    }, {
        path: '/person',
        name: 'personal',
        component: () => import("../components/personal"),
        redirect: spacehome,
        children: [
            {
                path:'/spacehome',
                name:'spacehome',
                component:spacehome
            },{
                path: '/spacevideo',
                name: 'spacevideo',
                component: () => import("@/components/personageSpace/spacevideo"),
            },{
                path: '/spacecollect',
                name: 'spacecollect',
                component: ()=> import("@/components/personageSpace/spacecollect")
            },{
                path:'/fansquery',
                name: 'fansquery',
                component:()=> import('@/components/personageSpace/fansquery'),
                redirect:fansAttention,
                children: [
                    {
                        path:'/fansAttention',
                        name:'fansAttention',
                        component:fansAttention
                    },{
                        path: '/fansBean',
                        name: 'fansBean',
                        component:()=> import('@/components/common/fans/fansBean')
                    }
                ]
            }
        ]
    },{
        path:'/others',
        name: 'others',
        redirect:othershome,
        component:()=> import('@/components/common/othersspace/others'),
        children: [
            {
                path: '/othershome',
                name: 'othershome',
                component: othershome,
            },{
                path: '/othersvideo',
                name: 'othersvideo',
                component:()=> import('@/components/common/othersspace/othersvideo'),
            }
        ]
    }, {
        path: '/message',
        name: 'message',
        component: () => import("../components/Message")
    }, {
        path: '/mvideo',
        name: 'Mvideo',
        component: () => import("../components/Mvideo")
    }, {
        path: '/Vedios',
        name: 'Vedios',
        component: Vedio,
        props: true
    }, {
        path: '/history',
        name: 'history',
        component: () => import("../components/history")
    }
]

const router = new VueRouter({
    routes
})

export default router
